{{define "content"}}
    <div id="main">

        <!-- 面包屑导航 -->
        <div id="bread" class="box list sky-blue">
            <span class="left">
                <a href="/">{{.Gobbs.title}}</a>
				   <img src="/images/divider.gif" /> {{.ForumRoot.Name}}
				   <img src="/images/divider.gif" /> <a href="/forum/{{.Forum.Fid}}">{{.Forum.Name}}</a>

            </span>
			<!--
            <span class="right">[<a href="#">申请版主</a>] <em class="gray">版主:</em> 
            &nbsp;<a href="#">#</a>
			</span>
			-->
        </div>

        <!-- 按钮上 -->
        <div id="atopbtns" class="list">
            <div class="left">
                <p class="post_btn">
                    <a href="/forum/post?fid={{.Thread.Fid}}">发表新帖</a>
                    <a href="/forum/reply?tid={{TplObjectID .Thread.Tid}}">回复主题</a>
                    <a onclick="cat_toggle(this, 'adminlist')" href="#">管理菜单</a>
                </p>
            </div>
            <dl id="adminlist" style="display:none">
                <dd><a href="/admin/delete?checkId[]={{.Thread.Tid}}&fid={{.Thread.Fid}}">删帖</a></dd>
                <dd><a href="/admin/top&checkId[]={{.Thread.Tid}}&fid={{.Thread.Fid}}">置顶</a></dd>
                <dd><a href="/admin/move&checkId[]={{.Thread.Tid}}&fid={{.Thread.Fid}}">移动</a></dd>
                <dd><a href="/admin/up&checkId[]={{.Thread.Tid}}&fid={{.Thread.Fid}}">提前</a></dd>
                <dd><a href="/admin/light&checkId[]={{.Thread.Tid}}&fid={{.Thread.Fid}}">加亮</a></dd>
                <dd><a href="/admin/pith&checkId[]={{.Thread.Tid}}&fid={{.Thread.Fid}}">精华</a></dd>
                <dd><a href="/admin/lock&checkId[]={{.Thread.Tid}}&fid={{.Thread.Fid}}">锁定</a></dd>
            </dl>
            <div class="right">
                <p class="post_btn2">
					<!--<a href="#">已经被您收藏</a>-->
					<a href="/user/favorite?tid={{TplObjectID .Thread.Tid}}" >放进我的收藏</a>
                    <a href="#">推荐给好友</a>
                </p>
            </div>
        </div>

        <!-- 主帖 -->
        {{$Thread := .Thread}}
        {{$TopID := .PostNum.Down}}
        {{$CheckIsAdmin := .CheckIsAdmin}}
        {{$hideContent := .hideContent}}

<link rel="stylesheet" type="text/css" href="/scripts/md/markdown.css" />
<link rel="stylesheet" type="text/css" href="/css/gobbs.css" />

<script type="text/javascript" src="/scripts/md/Markdown.Converter.js"></script>
<script type="text/javascript" src="/scripts/md/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="/scripts/md/Markdown.Editor.js"></script>

		{{range .PostList}}
        <div class="list">
			{{if eq .Post.First 1}}
            <h1 class="block_sub"><em class="black">主题：</em>{{.Post.Subject}}</h1>
            <div class="detail_table mainbox">
			{{else}}
			<div class="detail_table box">
            {{end}}
                <table>
                    <tbody>
                        <tr>
                            <td class="postauthor">
							  {{if neq .Post.Anonymous 1}}
                                <div class="pad">
                                    <div class="pic">
                                        <a href="/user/{{TplObjectID .User.Userid}}"><img src="/images/avatars/{{if eq .User.Photo ""}}000.jpg{{else}}{{.User.Photo}}{{end}}" border="0"/></a>
                                    </div>
                                    <ul class="txt">
                                        <li class="n1"><a href="/user/{{TplObjectID .User.Userid}}" target="_blank">个人资料</a></li>
                                        <li class="n3"><a href="/forum/search?key={{TplObjectID .User.Userid}}&type=user">搜索主题</a></li>
                                    </ul>
                                </div>
                                <p class="pad auth">
                                    <img src="/images/user_online.gif" />
                                    <em class="b"><a href="/user/{{TplObjectID .User.Userid}}">{{.User.Username}}</a></em>
                                </p>
                                <p class="pad nickname">{{.User.Alias}}</p>
                                <p class="pad"><img src="/images/star/{{.Group.Stars}}" /></p>
                                <div class="pad">
                                    <ul>
                                        <li>用户等级：{{.Group.Grouptitle}}</li>
                                        <li>发帖数量：{{.User.Posts}}</li>
                                        <li>精华主题：{{.User.Piths}}</li>
                                        <li>用户积分：{{.User.Credit}}</li>
                                        <li>用户贡献：{{.User.Cbcredit}}</li>
                                        <li>最后登录：<em class="gray">{{TplTime .User.Lasttime "2006-01-02"}}</em></li>
                                        <li>
											<!--
											<img src="/images/honor/" width="20" height="35" border="0" alt="" title="">
											-->
                                        </li>
                                    </ul>
                                </div>
								{{else}}
								匿名
								{{end}}
                            </td>
                            <td class="postcontent">
                                <div class="postinfo">
                                    发表于：{{TplObjectTime .Post.Pid ""}}
                                    {{if eq .Post.First 1}}
                                    <!--主题-->
                                     | <a href="/forum/search?key={{TplObjectID .User.Userid}}&type=user">查看该作者的帖子</a>
                                    <span class="right">楼主</span>
                                    {{else}}
                                    <!--回复-->
                                    <span class="right">{{TplDownID $TopID}}楼 {{if eq $Thread.Type "price"}}得分<em class="red b">0</em>分{{end}} </span>
                                    {{end}}
                                </div>
                                <div class="defaultpost">
                                    <h1 class="title" class="b"><!--<img src="/images/icon/7.gif" />-->{{.Post.Subject}}</h1>
                                    {{if eq .Post.First 1}}
	                                    <!--主题-->
	                                    <!--
										{*if $checkReply eq '1'*}
										<blockquote class="limitarea">此主题需需回复后查看！</blockquote>
										{*elseif $checkReply eq '2'*}
										<blockquote class="allowarea">此主题需需回复后查看！你已回复过此主题！</blockquote>
										{*/if*}
										{*if $checkLevel eq '1'*}
	                                    <blockquote class="limitarea">此主题需等级阅读达到<em class="red b">{*$oThread->readlevel*}</em>可查看！</blockquote>
										{*elseif $checkLevel eq '2'*}
	                                    <blockquote class="allowarea">你现在的等级阅读可以正常浏览此主题！</blockquote>
										{*/if*}
										{*if $checkOrder eq '1'*}
	                                    <blockquote class="limitarea">
	                                        <span class="right">
	                                            [已有{*$sumOrderTopic*}人购买] 
	                                            <a href="#" class="read" onClick="openSmall('order_thread.php?tid={*$oThread->tid*}');">查看</a>
	                                            <a href="submit_order.php?tid={*$oThread->tid*}" class="buy b">购买主题</a>
	                                        </span>
	                                        此主题需要花<em class="red b">{*$oThread->readorder*}积分</em>才能查看！
	                                    </blockquote>
										{*elseif $checkOrder eq '2'*}
	                                    <blockquote class="allowarea">
	                                        <span class="right" style="color:#000;">
	                                            [已有{*$sumOrderTopic*}人购买] 
	                                            <a href="#" class="read" onClick="openSmall('order_thread.php?tid={*$oThread->tid*}');">查看</a>
	                                        </span>
	                                        您已花了<em class="red b">{*$oThread->readorder*}积分</em>购买了此主题！
	                                    </blockquote>
										{*/if*}
										{*if $checkPrice eq '1'*}
	                                    <blockquote class="limitarea">此主题为悬赏主题，悬赏<em class="red b">{*$oThread->askprice*}</em>积分， 还剩<em class="red b">{*$iPrice*}</em>积分！</blockquote>
										{*elseif $checkPrice eq '2'*}
	                                    <blockquote class="allowarea">此主题为悬赏主题，悬赏<em class="red b">{*$oThread->askprice*}</em>积分， 已经结贴！</blockquote>
										{*/if*}
										-->
										<!--展现内容-->
										{{if eq $hideContent 0}}
	                                    <p class="mdcontent">{{.Post.Content}}</p>
	                                    {{end}}
                                    {{else}}
                                    <!--回复-->
                                    <p class="mdcontent">{{.Post.Content}}</p>
                                    {{end}}
                                </div>
                                {{if eq .Post.First 1}}
	                                <!-- 附件区 -->
	                                <!--
									{*if $item->uploadfile*}
	                                <div class="att_content">
									{* foreach from=$item->uploadfile  key = key2 item=item2 *}
	                                    <div class="fj">
	                                        说明：{*$item2->intro*}<br />
											{*if $item2->images eq 'Y'*}<a href="/upload/{*$item2->filedir*}/{*$item2->newname*}" target="_blank"><img src="/upload/{*$item2->filedir*}/{*$item2->newname*}" border="0" alt="点击查看全图"  title="点击查看全图" onload='javascript:drawImage(this);'></a><br />{*/if*}
	                                        附件：<img src="/images/file/{*$item2->fileext*}.gif" /><a href="download.php?fileid={*$item2->fileid*}" target="_blank" class="red">{*$item2->oldname*}</a> ({*$item2->filesize*} K) 下载次数:{*$item2->dlnumber*} 
											{*if $item2->readreply eq '1'*}&nbsp;回复查看{*/if*}
											{*if $item2->ordertype eq 'credit'*}&nbsp;售价:{*$item2->ordernumber*}积分{*/if*}
	                                    </div>
									{*/foreach*}
	                                </div>
									{*/if*}
									-->
								{{end}}
                                {{if neq .Post.First 1}}
									<!-- 悬赏start -->
									<!--
									{*if $checkPrice && $item->aprice*}
									<div style="margin:5px 20px; zoom:1; overflow:hidden;">
										<div class="offer_tip">
											<em>
											{*if $item->aprice->isbest eq '1'*}
											最佳答案奖励
											{*elseif $item->aprice->isbest eq '2' *}
											第二答案奖励
											{*elseif $item->aprice->isbest eq '3' *}
											第三答案奖励
											{*/if*}
											</em>: (+{*$item->aprice->credit*}) 积分
										</div>
									</div>
									{*elseif $checkPrice eq '1' && $oThread->userid neq $item->userid*}
									<div style="margin:5px 20px; zoom:1; overflow:hidden;">
										<div class="offer_tip">
											<em>管理操作</em>:  [<a href="submit_price.php?pid={*$item->pid*}">悬赏结贴</a>]
										</div>
									</div>
									{*/if*}
									-->
									<!-- 悬赏end -->
								{{end}}
                                <!--<p class="eidtted gray">此帖子在2009-09-09 被 wangyz 编辑过</p>-->

                                {{if eq .Post.Usesig 1 }}<div class="post_sign">{{.User.Sight}}</div>{{end}}
                            </td>
                        </tr>
                        <tr>
                            <td class="postauthor">
                                <p class="pad lasttime">注册时间：<em class="gray">{{TplObjectTime .User.Userid  "2006-01-02"}}</em></p>
                            </td>
                            <td class="postcontent">
                                <div class="postactions">
                                    <span class="right">
										{{if eq .Post.First 1}}
                                        <a href="/flower?tid={{TplObjectID $Thread.Tid}}&type=plus">鲜花</a>(<em class="red">{{$Thread.Flower}}</em>)
                                        <a href="/flower?tid={{TplObjectID $Thread.Tid}}&type=minus">鸡蛋</a>(<em class="red">{{$Thread.Egg}}</em>)
                                        {{end}}
                                        <a href="/foum/modify?pid={{TplObjectID .Post.Pid}}" class="gray">修改</a>
                                        <a href="/foum/modify?pid={{TplObjectID .Post.Pid}}&type=delete" class="gray">删除</a>
                                        <a href="/foum/reply?pid={{TplObjectID .Post.Pid}}&type=quote">引用</a>
                                        <a href="/foum/reply?pid={{TplObjectID .Post.Pid}}">回复</a>
                                        <a href="#topbar"><img src="/images/top.gif" /></a>
                                    </span>
									<span  class="gray">IP:{{if eq $CheckIsAdmin 1 }} {{.Post.Useip}} {{else}}隐藏{{end}}</span>&nbsp;<a href="/admin/limit?userid={{.Post.Userid}}&fid={{$Thread.Fid}}&tid={{$Thread.Tid}}"  class="gray">禁言</a>&nbsp;
                                    阅读次数:{{$Thread.Views}} 回复次数:{{$Thread.Replies}}  
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

		{{end}}
        <!-- 按钮下 -->
        <div class="list">
            <div class="left">
                <p class="post_btn">
                    <a class="post_btn left" href="/forum/post?fid={{.Thread.Fid}}">发表新帖</a>
                    <a class="post_btn left" href="/forum/reply?tid={{TplObjectID .Thread.Tid}}">回复主题</a>

                </p>
            </div>

            <div class="right">
                <p class="post_btn2">
                    <a href="/forum/jump?tid={{.Thread.Fid}}&type=pre">上一主题</a>
                    <a href="/forum/jump?tid={{.Thread.Fid}}&type=next">下一主题</a>
                </p>
            </div>
            <div class="right">
                <p class="post_page">
                   {{with .PostNum}}
                   {{.List}}
                   {{end}}
                </p>
            </div>
        </div>

        <!-- 快速回复 -->
            <fieldset id="quick_post">
                <legend>快速回复</legend>
				<form method="post" action="/forum/reply?act=do">
                <div class="quick_table">
                    <table>
                        <tbody>
                            <tr>
                                <td class="qpost_set">
                                    <blockquote>
                                        <dl>
                                            <dt class="b">选项</dt>
                                            <dd><input type="checkbox" name="allowbbcode" value="1" {{if eq .UserGroup.Allowubbcode 0 }}disabled{{end}} checked>使用Markdown</dd>
                                            <dd><input type="checkbox" name="usesig" value="1" {{if eq .UserGroup.Allowsig 0 }}disabled{{end}} checked>使用我的签名</dd>
                                            <dd><input type="checkbox" name="isanonymous" value="1" {{if eq .UserGroup.Allowanonymous 0 }}disabled{{end}} >使用匿名发帖</dd>
                                        </dl>
                                    </blockquote>
                                </td>
                                <td class="qpost_content">
                                    <p>{{if eq .SessUserID ""}}登录后，才可以发表回复! &nbsp;&nbsp;<a class="darkLink" href="#">登录</a> | <a class="darkLink" href="#">注册</a>
									{{else}}
									{{.SessUserName}}，您现在可以发表回复
									{{end}}</p>
                                    <p><textarea onfocus="fcolor(this)" onblur="bcolor(this)" style="width:99%;" rows="8" cols="80" name="elm1" id="elm1" ></textarea></p>
                                    <p><em class="red"><input type="submit" class="submit left" value="发表主题">回帖是一种美德！每天回帖即可获得积分和贡献！</em></p>
                                    <blockquote class="tip gray"> 这里发帖，表示您接受了谷丝社区的 用户行为准则。
 请您对您的言行负责，并遵守中华人民共和国有关法律、法规,尊重网上道德。</blockquote>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
				<input type="hidden" name="fid" value="{{.Thread.Fid}}">
				<input type="hidden" name="tid" value="{{TplObjectID .Thread.Tid}}">
				</form>
            </fieldset>
    </div>

<!--解析markdown--->
<script type="text/javascript">
var converter = new Markdown.Converter();
 
$("p.mdcontent").each(function()
{
    $(this).html(converter.makeHtml( $(this).html()));
});

</script>

{{end}}
